
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections;
using System.Text.RegularExpressions;
using System.Xml;
using Swaf;

namespace Swaf.DataAccess
{
	/// <summary>
	/// Summary description for BizObjGroupContainerNode.
	/// </summary>
	public class BizObjGroupContainerNode
	{
		protected string m_catalogName="";
		protected IList m_groups=new ArrayList();
		public BizObjGroupContainerNode(Match mr, object extraInfo)
		{
			if(extraInfo != null && extraInfo is XmlElement)
			{
				XmlElement el = (XmlElement)extraInfo;
				initializeFromElement(el);
			}
		}

		public BizObjGroupContainerNode(XmlElement el, string catalogName)
		{
			m_catalogName =catalogName;
			initializeFromElement(el);
		}
		private void initializeFromElement(XmlElement el)
		{
			IGroupFormatter formatter=null;

			foreach(XmlNode childNode in el.ChildNodes)
			{
                if (childNode is XmlElement)
                {
                    XmlElement child = childNode as XmlElement;
                    formatter = (IGroupFormatter)Application.currentApp.factories["BizObjGroupFormatters"].createFromPattern(child.Name, child);
                    if (formatter != null)
                    {
                        m_groups.Add(formatter);
                    }
                }
			}
		}
		public IList groups
		{
			get{return m_groups;}
		}
	}
}
